package com.mcx.modules.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author mcx
* @date 2022-04-30
**/
@Entity
@Data
@Table(name="player_material")
public class PlayerMaterial implements Serializable {

    @Id
    @Column(name = "id")
    @ApiModelProperty(value = "编号")
    private Integer id;

    @Column(name = "status",nullable = false)
    @NotNull
    @ApiModelProperty(value = "状态")
    private Integer status;

    @Column(name = "role_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "角色Id")
    private Integer roleId;

    @Column(name = "createtime",nullable = false)
    @NotNull
    @ApiModelProperty(value = "创建时间")
    private Timestamp createtime;

    @Column(name = "updatetime")
    @ApiModelProperty(value = "更新时间")
    private Timestamp updatetime;

    @Column(name = "material_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "基础材料编号")
    private Integer materialId;

    @Column(name = "is_inlay",nullable = false)
    @NotNull
    @ApiModelProperty(value = "是否已经镶嵌")
    private Integer isInlay;

    @Column(name = "inlay_equip_server_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "镶嵌到的装备编号")
    private Integer inlayEquipServerId;

    public void copy(PlayerMaterial source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}